﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace TestModule
{
    /// <summary>
    /// 点样式类型
    /// </summary>
    public enum PointType 
    {
        STAR_POINT = 0, // *星型
        RECT_POINT = 1,//矩形
        ARC_POINT = 2, //圆形
        NORMAL_POINT =3 //无特殊样式
    }

    /// <summary>
    /// 绘图点单元符号
    /// </summary>
    public class NodePoint : NodeSymbol
    {
        private PointType _symboltype = PointType.NORMAL_POINT;
        public PointType Symboltype
        {
            get { return _symboltype; }
            set { _symboltype = value; }
        }

        /// <summary>
        /// 坐标
        /// </summary>
        private Point _basePoint = new Point() { X = 0, Y = 0 };
        public Point BasePoint
        {
            get { return _basePoint; }
            set { _basePoint = value; }
        }

        /// <summary>
        /// 绘制点
        /// </summary>
        public override void Draw(Graphics img)
        {
            if (BRemark)
                img.DrawString(this.Remark, new Font("Verdana", 10), new SolidBrush(Color.Tomato), this.BasePoint);

            if (BNo)
                img.DrawString(this.Index.ToString(), new Font("Verdana", 10), new SolidBrush(Color.Tomato), this.BasePoint);

            switch (this.Symboltype)
            {
                case PointType.STAR_POINT:
                    img.DrawString("*", new Font("Verdana", 20), new SolidBrush(Color.Tomato), new RectangleF(this.BasePoint.X - 10, this.BasePoint.Y - 10, 20, 20));
                    break;
                case PointType.RECT_POINT:
                    img.DrawString("□", new Font("Verdana", 10), new SolidBrush(Color.Tomato), new RectangleF(this.BasePoint.X - 5, this.BasePoint.Y - 5, 10, 10));
                    break;
                case PointType.ARC_POINT:
                    img.DrawString("○", new Font("Verdana", 10), new SolidBrush(Color.Tomato), new RectangleF(this.BasePoint.X - 5, this.BasePoint.Y - 5, 10, 10));
                    break;
                case PointType.NORMAL_POINT:
                    img.DrawString(".", new Font("Verdana", 15), new SolidBrush(Color.Tomato), new RectangleF(this.BasePoint.X - 7, this.BasePoint.Y - 7, 15, 15));
                    break;
                default:
                    break;
            }
        }
    }
}
